#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //初始化第一个输入框
    ui->lineEdit_name->setPlaceholderText("请输入姓名");
    ui->lineEdit_name->setClearButtonEnabled(true);

    //初始化第二个输入框
    ui->lineEdit_password->setPlaceholderText("请输入密码");
    ui->lineEdit_password->setClearButtonEnabled(true);
    ui->lineEdit_password->setEchoMode(QLineEdit::Password);

    ui->lineEdit_phone->setPlaceholderText("请输入电话号码");
    ui->lineEdit_password->setClearButtonEnabled(true);
    //验证手机号码必须是 11位数字，并且按照 344 的格式来输入
    ui->lineEdit_phone->setInputMask("000-0000-0000");
}



Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    QString gender = ui->lineEdit_name->text();

    qDebug() << "姓名：" << ui->lineEdit_name->text()
           << "密码：" << ui->lineEdit_password->text()
           << "性别：" << gender
           << "手机：" << ui->lineEdit_phone->text();
}

